Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL: Add "POSITION" function. #6596

Merged
merged 1 commit into from
Nov 13, 2018
Merged

SQL: Add "POSITION" function. #6596

merged 1 commit into from
Nov 13, 2018

Conversation

gianm
Copy link
Contributor

@gianm gianm commented Nov 10, 2018

Also add a "fromIndex" argument to the strpos expression function. There
are some -1 and +1 adjustment terms due to the fact that the strpos
expression behaves like Java indexOf (0-indexed), but the POSITION SQL
function is 1-indexed.

Also add a "fromIndex" argument to the strpos expression function. There
are some -1 and +1 adjustment terms due to the fact that the strpos
expression behaves like Java indexOf (0-indexed), but the POSITION SQL
function is 1-indexed.
@gianm gianm added this to the 0.13.1 milestone Nov 10, 2018
Copy link
Member

@clintropolis clintropolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM 👍, would it be worth adding an alternate, sql friendly, 1 based index version of the 'strpos' expression so we don't have to eat the +1 -1 or do you expect the impact to be negligible?

@gianm
Copy link
Contributor Author

gianm commented Nov 12, 2018

I think it will be negligible once expressions are optimized a bit more (a project for a later time).

@jon-wei jon-wei merged commit 154b6fb into apache:master Nov 13, 2018
@gianm gianm deleted the postition-func branch November 13, 2018 21:41
gianm added a commit to implydata/druid-public that referenced this pull request Nov 16, 2018
Also add a "fromIndex" argument to the strpos expression function. There
are some -1 and +1 adjustment terms due to the fact that the strpos
expression behaves like Java indexOf (0-indexed), but the POSITION SQL
function is 1-indexed.
gianm added a commit to implydata/druid-public that referenced this pull request Nov 16, 2018
Also add a "fromIndex" argument to the strpos expression function. There
are some -1 and +1 adjustment terms due to the fact that the strpos
expression behaves like Java indexOf (0-indexed), but the POSITION SQL
function is 1-indexed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants